<template>
	<view>
		<view class="swiper" style="padding: 20rpx;background-color: #fff;">
			<u-swiper :list="swiperList" height="300" @click="to"></u-swiper>
		</view>
		<view class="news" style="margin-top: 20rpx;">
			<u-sticky offset-top="0">
				<u-tabs :list="tabList" :is-scroll="false" :current="tabCurrent" @change="tabChange"
					active-color="#fa3534"></u-tabs>
			</u-sticky>
			<view class="news-list" style="padding: 20rpx;background-color: #fff;">
				<view class="news-item" style="display: flex;flex-direction: row;
				justify-content: space-between;padding: 20rpx 0;border-top: 2rpx solid #e4e7ed;" v-for="item in newsList">
					<view class="left" style="width: 450rpx;">
						<view class="top" style="height: 168rpx;">
							<view class="progress" style="display: flex;flex-direction: row;justify-content: space-between;">
								<text class="line" style="font-weight: bold;font-size: 32rpx;">
									{{item.title}}{{tabCurrent + 1}}
								</text>
								<view class="status center" style="width: 120rpx;
							height: 60rpx;
							background-color: #19b16b;
							color: white;
							font-size: 26rpx;
							padding: 20rpx;
							border-radius: 10rpx;
							background-color: #909399;
							" v-if="item.color === '#909399'">{{item.status}}</view>
							<view class="status center" style="width: 120rpx;
							height: 60rpx;
							background-color: #19b16b;
							color: white;
							font-size: 26rpx;
							padding: 20rpx;
							border-radius: 10rpx;
							background-color: #2979ff;
							" v-if="item.color === '#2979ff'">{{item.status}}</view>
							<view class="status center" style="width: 120rpx;
							height: 60rpx;
							background-color: #19b16b;
							color: white;
							font-size: 26rpx;
							padding: 20rpx;
							border-radius: 10rpx;
							background-color: #fa3534;
							" v-if="item.color === '#fa3534'">{{item.status}}</view>
							</view>
								<u-line-progress :active-color="item.color" :percent="item.percent"
									style="width: 400rpx;margin-top: 45rpx;"></u-line-progress>
						</view>
						<view class="bottom" style="display: flex;flex-direction: row;font-size: 22rpx;
						color: #666;">
							<text>{{item.readNum}} 阅读</text>
							<text style="margin-left: 20rpx;">{{item.publishDate}}</text>
						</view>
					</view>
					<view class="right center">
						<navigator url="/pages/lesson-detail/lesson-detail">
							<image src="/static/DangJian1.jpg.jpg" mode="" style="width: 250rpx;height: 200rpx;">
							</image>
						</navigator>
					</view>
				</view>
				<u-divider>没有更多了</u-divider>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: '',
				swiperList: [{
						image: '../../static/DangJian1.jpg.jpg'
					},
					{
						image: '../../static/DangYuanHuoDong1.jpg.jpg'
					},
					{
						image: '../../static/u=604788707,102911010&fm=26&fmt=auto&gp=0.jpg'
					}
				],
				tabList: [{
						name: '五四运动'
					},
					{
						name: '改革开放'
					},
					{
						name: '百年党史'
					}
				],
				tabCurrent: 0,
				newsList: [
					{
						title: '永远跟党走',
						percent: 100,
						status: '已学习',
						readNum: 99,
						publishDate: '2023-9-26',
						color: '#909399'
					},
					{
						title: '永远跟党走',
						percent: 50,
						status: '学习中',
						readNum: 99,
						publishDate: '2023-9-26',
						color: '#2979ff'
					},
					{
						title: '永远跟党走',
						percent: 0,
						status: '未学习',
						readNum: 99,
						publishDate: '2023-9-26',
						color: '#fa3534'
					},
					{
						title: '永远跟党走',
						percent: 0,
						status: '未学习',
						readNum: 99,
						publishDate: '2023-9-26',
						color: '#fa3534'
					},
					{
						title: '永远跟党走',
						percent: 0,
						status: '未学习',
						readNum: 99,
						publishDate: '2023-9-26',
						color: '#fa3534'
					}
				]
			};
		},
		methods: {
			tabChange(index) {
				this.tabCurrent = index
			},
			to(){
				uni.navigateTo({
					url:'/pages/lesson-detail/lesson-detail'
				})
			}
		}
	}
</script>

<style lang="scss">

</style>